/*
 * Copyright 2002-2007 the original author or authors.
 *
 * Licensed under the Apache license, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.internna.iwebjtracker.services;

import javax.servlet.http.HttpServletRequest;
import org.internna.iwebjtracker.model.TrackerUser;
import org.internna.iwebmvc.model.UUID;

/**
 * Remote administration of tracker users.
 *
 * @author Jose Noheda
 * @since 1.0
 */
public interface TrackerUserManager {

    /**
     * Allows anonymous clients to become application users giving the less information possible.
     *
     * @param username any string
     * @param password any string
     * @param email any string
     * @return a non empy string if a validation error happened
     */
    String register(String username, String password, String email);

    /**
     * Allows anonymous clients to become application users.
     *
     * @param user any
     * @return a non empy string if a validation error happened
     */
    String register(TrackerUser user);

    /**
     * Allows a logged in user to change his password.
     *
     * @param password any
     * @return the validation error or null if successful
     */
    String changePassword(String password);

    /**
     * Obtains a tracker user from its security counterpart.
     *
     * @param username any
     * @return
     */
    TrackerUser getTrackerUser(String username);

    /**
     * Obtains a tracker user from the current logged in user.
     *
     * @return any
     */
    TrackerUser getCurrentTrackerUser();

    /**
     * Allows a user to provide his/her name, location and sex for the profile.
     *
     * @param name any
     * @param sex any
     * @param country any
     */
    void editOfflineInformation(String name, UUID sex, UUID country, HttpServletRequest request);

    /**
     * Stores user preferences.
     *
     * @param email a valid email or null
     * @param theme one of the supported themes or null
     * @param locale one of the supported locales or null
     */
    void editPreferences(String email, String theme, String locale, HttpServletRequest request);

}
